package com.qeado.content.service.impl;

import java.util.List;
import java.util.UUID;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.qeado.content.dao.PlantAreaManageDao;
import com.qeado.content.model.PlantArea;
import com.qeado.content.service.PlantAreaManageService;

@Service
public class PlantAreaManageServiceImpl implements PlantAreaManageService {
	@Autowired
	private PlantAreaManageDao plantAreaManageDao;

	@Override
	public void deletePlantArea(String id) {
		plantAreaManageDao.deletePlantArea(id);
	}

	@Override
	public List<PlantArea> getPlantTypeList() {
		return plantAreaManageDao.getPlantTypeList();
	}

	@Override
	public List<PlantArea> getProvinceList() {
		return plantAreaManageDao.getProvinceList();
	}

	@Override
	public String savePlantArea(PlantArea plantArea) {
		if(plantArea.getId() == null || "".equals(plantArea.getId())) {
			plantArea.setId(UUID.randomUUID().toString());
			plantAreaManageDao.insertPlantArea(plantArea);
		} else {
			plantAreaManageDao.savePlantArea(plantArea);
		}
		return null;
	}

	@Override
	public List<PlantArea> searchPlantArea(PlantArea plantArea) {
		return plantAreaManageDao.searchPlantArea(plantArea);
	}

	@Override
	public PlantArea searchPlantAreaById(String id) {
		return plantAreaManageDao.searchPlantAreaById(id);
	}

}
